package com.yida.gwj.expend.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yida.gwj.api.domain.GwjConfFlow;
import com.yida.gwj.api.domain.GwjFinanceAccountDetail;
import com.yida.gwj.api.domain.GwjFinanceAccountMain;
import com.yida.gwj.api.domain.request.RemoteGwjFinanceAccountDetailRequest;
import com.yida.gwj.api.domain.request.RemoteGwjFinanceAccountMainRequest;
import com.yida.gwj.common.enums.GwjBusinessFlagType;
import com.yida.gwj.expend.domain.GwjMaintenanceFundsBusinessHouse;
import com.yida.gwj.expend.domain.dto.AcceptanceReportDTO;
import com.yida.gwj.expend.domain.dto.AllocatedAmountListDTO;
import com.yida.gwj.expend.domain.dto.AllocatedAmountSelectDTO;
import com.yida.gwj.expend.domain.dto.Application4ApprovalDTO;
import com.yida.gwj.expend.domain.dto.ApplyAppropriateReportDTO;
import com.yida.gwj.expend.domain.dto.Appropriate4ApproveDTO;
import com.yida.gwj.expend.domain.dto.ConfirmReceiptDTO;
import com.yida.gwj.expend.domain.dto.GwjMaintenanceFundsBusinessGetInfoDTO;
import com.yida.gwj.expend.domain.dto.GwjMaintenanceFundsBusinessListDTO;
import com.yida.gwj.expend.domain.dto.OneTimeNotificationDTO;
import com.yida.gwj.expend.domain.dto.StepConfigInfoDTO;
import com.yida.gwj.expend.domain.dto.TotalCostShareListDTO;
import com.yida.gwj.expend.domain.request.AllocatedAmountRequest;
import com.yida.gwj.expend.domain.request.BusinessProcessRequest;
import com.yida.gwj.expend.domain.request.EditFormRequest;
import com.yida.gwj.expend.domain.request.GwjMaintenanceFundsBusinessListRequest;
import com.yida.gwj.expend.domain.request.SubmitRequest;
import com.yida.gwj.expend.enums.BusinessAttachmentServerTypeEnum;
import com.yida.gwj.expend.service.IGwjMaintenanceFundsBusinessAppropriateService;
import com.yida.gwj.expend.service.IGwjMaintenanceFundsBusinessService;
import com.yida.gwj.expend.service.IGwjMaintenanceFundsBusinessUrgentAppropriateService;

/**
 * 应急拨付内网预受理service
 *
 * @author wkz
 * @date 2023/04/10
 */
@Service
public class GwjMaintenanceFundsBusinessUrgentAppropriateServiceImpl implements IGwjMaintenanceFundsBusinessUrgentAppropriateService {
    private final Logger log = LoggerFactory.getLogger(GwjMaintenanceFundsBusinessUrgentAppropriateServiceImpl.class);

    @Autowired
    private IGwjMaintenanceFundsBusinessAppropriateService gwjMaintenanceFundsBusinessAppropriateService;
    @Autowired
    private IGwjMaintenanceFundsBusinessService maintenanceFundsBusinessService;

    /**
     * 查询公维金维修资金业务列表
     *
     * @param maintenanceFundsBusinessListRequest 公维金维修资金业务
     * @return 公维金维修资金业务集合
     */
    @Override
    public List<GwjMaintenanceFundsBusinessListDTO> getGwjMaintenanceFundsBusinessList(GwjMaintenanceFundsBusinessListRequest maintenanceFundsBusinessListRequest) {
        return maintenanceFundsBusinessService.getGwjMaintenanceFundsBusinessList(maintenanceFundsBusinessListRequest);
    }

    /**
     * 查询公维金维修资金业务
     *
     * @param businessId 公维金维修资金业务主键
     * @return 公维金维修资金业务
     */
    @Override
    public GwjMaintenanceFundsBusinessGetInfoDTO getInfoDetails(Long businessId) {
        return maintenanceFundsBusinessService.getInfoDetails(businessId);
    }

    /**
     * 根据flowId查询业务流程
     *
     * @param flowId 业务流程主键
     * @return 业务流程
     */
    @Override
    public GwjConfFlow selectGwjConfFlowByFlowId(Long flowId) {
        return maintenanceFundsBusinessService.selectGwjConfFlowByFlowId(flowId);
    }

    /**
     * 取件
     *
     * @param businessProcessRequest
     * @return int
     */
    @Override
    public int takeParts(BusinessProcessRequest businessProcessRequest) {
        return maintenanceFundsBusinessService.takeParts(businessProcessRequest);
    }

    /**
     * 退件
     *
     * @param businessProcessRequest
     * @return int
     */
    @Override
    public int preAcceptRetreat(BusinessProcessRequest businessProcessRequest) {
        return maintenanceFundsBusinessService.preAcceptRetreat(businessProcessRequest);
    }

    /**
     * 分摊金额-已选择
     *
     * @param allocatedAmountRequest
     * @return AllocatedAmountSelectDTO
     */
    @Override
    public AllocatedAmountSelectDTO allocatedAmountSelect(AllocatedAmountRequest allocatedAmountRequest) {
        return maintenanceFundsBusinessService.allocatedAmountSelect(allocatedAmountRequest);
    }

    /**
     * 使用申请-资金分摊-未选中列表
     *
     * @param allocatedAmountRequest 请求
     * @return 公维金维修资金业务
     */
    @Override
    public List<GwjMaintenanceFundsBusinessHouse> allocatedAmountCancelList(AllocatedAmountRequest allocatedAmountRequest) {
        return maintenanceFundsBusinessService.allocatedAmountCancelList(allocatedAmountRequest);
    }

    /**
     * 预受理附件审核
     *
     * @param bizId
     * @return int
     */
    @Override
    public int preAcceptExamine(Long bizId) {
        return gwjMaintenanceFundsBusinessAppropriateService.preAcceptExamine(bizId);
    }

    /**
     * 获取步骤按钮权限信息
     *
     * @return 查询业务基础信息
     */
    @Override
    public StepConfigInfoDTO getStepConfigInfo(GwjBusinessFlagType... businessFlagTypes) {
        return maintenanceFundsBusinessService.getStepConfigInfo(businessFlagTypes);
    }

    /**
     * 确认受理
     *
     * @param submitRequest 确认受理
     * @return int
     */
    @Override
    public int confirmAcceptance(SubmitRequest submitRequest) {
        return maintenanceFundsBusinessService.confirmAcceptance(submitRequest);
    }

    /**
     * 提交
     *
     * @param submitRequest 第一次检查
     * @return int
     */
    @Override
    public int submit(SubmitRequest submitRequest) {
        return gwjMaintenanceFundsBusinessAppropriateService.submit(submitRequest);
    }

    /**
     * 确认收件
     *
     * @param confirmReceipt 公维金维修资金业务
     * @return int
     */
    @Override
    public int confirmReceipt(ConfirmReceiptDTO confirmReceipt) {
        return maintenanceFundsBusinessService.confirmReceipt(confirmReceipt);
    }

    /**
     * 生成财务流水
     *
     * @param bizId 业务标识
     * @return {@link Application4ApprovalDTO}
     */
    @Override
    public int generateFinancialJournal(Long bizId) {
        return gwjMaintenanceFundsBusinessAppropriateService.generateFinancialJournal(bizId);
    }

    /**
     * 获取总账流水
     *
     * @param mainRequest 主要要求
     * @return {@link List}<{@link GwjFinanceAccountMain}>
     */
    @Override
    public List<GwjFinanceAccountMain> selectGwjFinanceAccountMainList(RemoteGwjFinanceAccountMainRequest mainRequest) {
        return gwjMaintenanceFundsBusinessAppropriateService.selectGwjFinanceAccountMainList(mainRequest);
    }

    /**
     * 获取验收报告
     *
     * @param bizId 业务标识
     * @return {@link AcceptanceReportDTO}
     */
    @Override
    public AcceptanceReportDTO getAcceptanceReport(Long bizId) {
        return gwjMaintenanceFundsBusinessAppropriateService.getAcceptanceReport(bizId);
    }

    /**
     * 获取申请拨付报告
     *
     * @param bizId 业务标识
     * @return {@link ApplyAppropriateReportDTO}
     */
    @Override
    public ApplyAppropriateReportDTO getApplyAppropriateReport(Long bizId) {
        return gwjMaintenanceFundsBusinessAppropriateService.getApplyAppropriateReport(bizId);
    }

    /**
     * 查询决算费用分摊清册
     *
     * @param bizId 业务标识
     * @return int
     */
    @Override
    public TotalCostShareListDTO costList(Long bizId) {
        return gwjMaintenanceFundsBusinessAppropriateService.costList(bizId, BusinessAttachmentServerTypeEnum.FINAL_COST_ALLOCATION_LIST);
    }

    /**
     * 查询分账列表
     *
     * @param detailRequest 分账查询参数
     * @return
     */
    @Override
    public List<GwjFinanceAccountDetail> selectGwjFinanceAccountDetailList(RemoteGwjFinanceAccountDetailRequest detailRequest) {
        return gwjMaintenanceFundsBusinessAppropriateService.selectGwjFinanceAccountDetailList(detailRequest);
    }

    /**
     * 一次性告知单
     *
     * @param bizId 业务标识
     * @return int
     */
    @Override
    public OneTimeNotificationDTO oneTimeNotification(Long bizId) {
        return maintenanceFundsBusinessService.oneTimeNotification(bizId);
    }

    /**
     * 查看申请报批
     *
     * @param bizId 业务标识
     * @return {@link Application4ApprovalDTO}
     */
    @Override
    public Application4ApprovalDTO getApplication4Approval(Long bizId) {
        return maintenanceFundsBusinessService.getApplication4Approval(bizId);
    }

    /**
     * 获取使用拨付申请表
     *
     * @param bizId 业务标识
     * @return {@link Application4ApprovalDTO}
     */
    @Override
    public Appropriate4ApproveDTO getAppropriate4Approval(Long bizId) {
        return maintenanceFundsBusinessService.getAppropriate4Approval(bizId);
    }

    /**
     * 导出房屋数据
     *
     * @param allocatedAmountRequest
     * @return 楼栋下房屋信息
     */
    @Override
    public List<AllocatedAmountListDTO> exportHouseList(AllocatedAmountRequest allocatedAmountRequest) {
        return maintenanceFundsBusinessService.exportHouseList(allocatedAmountRequest);
    }

    /**
     * 回退
     *
     * @param submitRequest 业务标识
     * @return int
     */
    @Override
    public int fallback(SubmitRequest submitRequest) {
        return gwjMaintenanceFundsBusinessAppropriateService.fallback(submitRequest);
    }

    /**
     * 编辑表单
     *
     * @param editFormRequest
     * @return int
     */
    @Override
    public int editForm(EditFormRequest editFormRequest) {
        return gwjMaintenanceFundsBusinessAppropriateService.editForm(editFormRequest);
    }

    /* 
     * 财务对账
     */
    @Override
    public Boolean financeCheck(SubmitRequest submitRequest) {
        return gwjMaintenanceFundsBusinessAppropriateService.financeCheck(submitRequest);
    }

    /* 
     * 案例办结操作
     */
    @Override
    public Boolean businessFinish(SubmitRequest submitRequest) {
        return gwjMaintenanceFundsBusinessAppropriateService.businessFinish(submitRequest);
    }
}
